package com.cloudream.listener;

import com.cloudream.entity.Config;
import com.cloudream.repository.ConfigDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created by CloudDreamRan on 2017/8/27.
 */
@Component
public class InitServlet implements ApplicationListener<ContextRefreshedEvent> {
    private static Logger logger = LoggerFactory.getLogger(InitServlet.class);

    @Autowired
    private ConfigDao configDao;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
        if(contextRefreshedEvent.getApplicationContext().getDisplayName().equals("Root WebApplicationContext")){
            System.out.println("Spring InitServlet自动加载启动开始");

            System.out.println("Spring InitServlet自动加载启动结束");
        }
    }

}
